<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg">
  <head>
    <title>Debugging</title>
    <link rel="stylesheet" type="text/css" href="docbook-epub.css"/>
    <link rel="stylesheet" type="text/css" href="kawa.css"/>
    <script src="kawa-ebook.js" type="text/javascript"/>
    <meta name="generator" content="DocBook XSL-NS Stylesheets V1.79.1"/>
    <link rel="prev" href="Parameter-objects.xhtml" title="Parameter objects"/>
    <link rel="next" href="Input-Output.xhtml" title="Input, output, and file handling"/>
  </head>
  <body>
    <header/>
    <section class="chapter" title="Debugging" epub:type="chapter" id="Debugging">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title">Debugging</h2>
          </div>
        </div>
      </div>
      <p class="synopsis" kind="Syntax"><span class="kind">Syntax</span><span class="ignore">: </span><a id="idm139667873060208" class="indexterm"/> <code class="function">trace</code> <em class="replaceable"><code>procedure</code></em></p>
      <div class="blockquote">
        <blockquote class="blockquote">
          <p>Cause <em class="replaceable"><code>procedure</code></em> to be "traced", that is debugging output will
be written to the standard error port every time <em class="replaceable"><code>procedure</code></em>
is called, with the parameters and return value.
</p>
          <p>Note that Kawa will normally assume that a procedure defined with
the procedure-defining variant of <code class="literal">define</code> is constant,
and so it might be inlined:
</p>
          <pre class="screen">(define (ff x) (list x x))
(trace ff) ;; probably won't work
(ff 3)     ;; not traced
</pre>
          <p>It works if you specify the <code class="literal">--no-inline</code> flag to Kawa.
Alternatively, you can use the variable-defining variant of <code class="literal">define</code>:
</p>
          <pre class="screen">#|kawa:1|# (define ff (lambda (x) name: 'ff (list x x)))
#|kawa:2|# (trace ff) ;; works
#|kawa:3|# (ff 3)
call to ff (3)
return from ff =&gt; (3 3)
(3 3)
</pre>
          <p>Note the use of the <code class="literal">name:</code> procedure property to give the
anonymous <code class="literal">lambda</code> a name.
</p>
        </blockquote>
      </div>
      <p class="synopsis" kind="Syntax"><span class="kind">Syntax</span><span class="ignore">: </span><a id="idm139667873051408" class="indexterm"/> <code class="function">untrace</code> <em class="replaceable"><code>procedure</code></em></p>
      <div class="blockquote">
        <blockquote class="blockquote">
          <p>Turn off tracing (debugging output) of <em class="replaceable"><code>procedure</code></em>.
</p>
        </blockquote>
      </div>
      <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873047600" class="indexterm"/> <code class="function">disassemble</code> <em class="replaceable"><code>procedure</code></em></p>
      <div class="blockquote">
        <blockquote class="blockquote">
          <p>Returns a string representation of the disassembled bytecode
for <em class="replaceable"><code>procedure</code></em>, when known.
</p>
        </blockquote>
      </div>
    </section>
    <footer>
      <div class="navfooter">
        <p>
          Up: <a accesskey="u" href="pt01.xhtml">Part . Reference Documentation</a></p>
        <p>
        Previous: <a accesskey="p" href="Eval-and-Environments.xhtml">Eval and Environments</a></p>
        <p>
        Next: <a accesskey="n" href="Input-Output.xhtml">Input, output, and file handling</a></p>
      </div>
    </footer>
  </body>
</html>
